﻿using System.Globalization;
using System.Windows.Data;

namespace Super.Hmi.Converters
{
    /// <summary>
    /// 将字符串的第一个字符转换为字符类型的值转换器
    /// </summary>
    public class FirstCharConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null)
                return (value as string)[0];
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
